home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickDraw3D 1.6 SDK / Mac SampleCode Previous / Grab Bag Samples - Mac / Current QD3D Libs & Headers / Interfaces / QD3D.h next >
Encoding:
C/C++ Source or Header  |  1999-05-18  |  39.8 KB  |  1,216 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                              **
  3.  **     Module:        QD3D.h                                                     **                        
  4.  **                                                                              **
  5.  **                                                                              **
  6.  **     Purpose:     System include file.                                     **            
  7.  **                                                                              **
  8.  **                                                                              **
  9.  **                                                                              **
  10.  **     Copyright (C) 1992-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                              **
  12.  **                                                                              **
  13.  *****************************************************************************/
  14. #ifndef QD3D_h
  15. #define QD3D_h
  16.  
  17. #include <stdio.h>
  18.  
  19.  
  20. /******************************************************************************
  21.  **                                                                             **
  22.  **                                Porting Control                                 **
  23.  **                                                                             **
  24.  *****************************************************************************/
  25.  
  26. /*
  27.  *  NOTE:  To compile on a Unix workstation (assumes X11 window system):
  28.  *                1. Add to compiler command line: "-DOS_MACINTOSH=0"
  29.  *                2. Add "-DOS_UNIX=1"
  30.  *                3. Add "-DWINDOW_SYSTEM_X11=1"
  31.  */
  32.  
  33. #if defined(_WIN32) || defined(_WINDOWS)
  34.     #define OS_MACINTOSH                0
  35.     #define OS_WIN32                    1
  36.     #define OS_UNIX                        0
  37.     #define OS_NEXT                        0
  38.  
  39.     #define WINDOW_SYSTEM_MACINTOSH        0
  40.     #define WINDOW_SYSTEM_WIN32            1
  41.     #define WINDOW_SYSTEM_X11            0
  42.     #define WINDOW_SYSTEM_NEXT            0
  43.  
  44. #elif defined(NeXT) && NeXT
  45.     #define OS_MACINTOSH                0
  46.     #define OS_WIN32                    0
  47.     #define OS_UNIX                        0
  48.     #define OS_NEXT                        1
  49.     
  50.     #define WINDOW_SYSTEM_MACINTOSH        0
  51.     #define WINDOW_SYSTEM_WIN32            0
  52.     #define WINDOW_SYSTEM_X11            0
  53.     #define WINDOW_SYSTEM_NEXT            1
  54.  
  55. #elif !defined(OS_MACINTOSH)
  56.     #define OS_MACINTOSH                1
  57.     #define OS_WIN32                    0
  58.     #define OS_UNIX                        0
  59.     #define OS_NEXT                        0
  60.  
  61.     #define WINDOW_SYSTEM_MACINTOSH        1
  62.     #define WINDOW_SYSTEM_WIN32            0
  63.     #define WINDOW_SYSTEM_X11            0
  64.     #define WINDOW_SYSTEM_NEXT            0
  65.  
  66.     #if defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)
  67.          #define PRAGMA_ONCE                1
  68.     #else
  69.          #define PRAGMA_ONCE                0
  70.     #endif  /* defined(__MRC__) || defined(__SC__) || defined(__MWERKS__)  */
  71.  
  72.     /*
  73.      *  Set required compiler options (if possible):
  74.      *   1. enums must always be ints in QD3D and in applications;
  75.      *      this consistency is required to prevent misinterpretation
  76.      *      of an app's enum values by an API; it is also required for
  77.      *      compliance with ANSI
  78.      *   2. alignment of longs, floats, and pointers in structures
  79.      *      is on long boundaries for PowerPC
  80.      */
  81.     #if defined(__xlc__) || defined(__XLC121__)
  82.         #pragma options enum=int
  83.         #pragma options align=power
  84.     #elif defined(__MWERKS__)
  85.         #pragma enumsalwaysint on
  86.         #pragma options align=native
  87.     #elif defined(__MRC__) || defined(__SC__)
  88.         #if __option(pack_enums)
  89.             #define PRAGMA_ENUM_RESET_QD3D 1
  90.         #endif
  91.         #pragma options(!pack_enums)
  92.         #pragma options align=power
  93.     #endif
  94.     
  95.     
  96. #endif  /*  OS_MACINTOSH  */
  97.  
  98. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  99.     #pragma once
  100. #endif  /*  PRAGMA_ONCE  */ 
  101.  
  102.  
  103. #ifdef __cplusplus
  104. extern "C" {
  105. #endif    /* __cplusplus */
  106.  
  107.  
  108. /******************************************************************************
  109.  **                                                                             **
  110.  **                                Export Control                                 **
  111.  **                                                                             **
  112.  *****************************************************************************/
  113.  
  114. #if defined(_MSC_VER)    /* Microsoft Visual C */
  115.     #if defined(WIN32_EXPORTING)    /* define when building DLL */
  116.         #define QD3D_EXPORT __declspec( dllexport )     
  117.         #define QD3D_CALL    
  118.         #define QD3D_CALLBACK    
  119.     #else
  120.         #define QD3D_EXPORT
  121.         #define QD3D_CALL    __cdecl
  122.         #define QD3D_CALLBACK    __cdecl    
  123.     #endif /* WIN32_EXPORTING */
  124. #else
  125.     #define QD3D_EXPORT
  126.     #define QD3D_CALL    
  127.     #define QD3D_CALLBACK    
  128. #endif  /*  _MSC_VER  */
  129.  
  130.  
  131. /******************************************************************************
  132.  **                                                                             **
  133.  **                                NULL definition                                 **
  134.  **                                                                             **
  135.  *****************************************************************************/
  136.  
  137. #ifndef NULL
  138.     #error NULL is undefined.
  139. #endif /* NULL */
  140.  
  141.  
  142. /******************************************************************************
  143.  **                                                                             **
  144.  **                                    Objects                                     **
  145.  **                                                                             **
  146.  *****************************************************************************/
  147. /*
  148.  * Everything in QuickDraw 3D is an OBJECT: a bunch of data with a type,
  149.  * deletion, duplication, and i/o methods.
  150.  */
  151. typedef long                    TQ3ObjectType;
  152.  
  153. typedef struct TQ3ObjectPrivate    *TQ3Object;
  154.  
  155. /*
  156.  * There are four subclasses of OBJECT:
  157.  *    an ELEMENT, which is data that is placed in a SET
  158.  *    a SHAREDOBJECT, which is reference-counted data that is shared
  159.  *    VIEWs, which maintain state information for an image
  160.  *    a PICK, which used to query a VIEW
  161.  */
  162. typedef TQ3Object                TQ3ElementObject;
  163. typedef TQ3Object                TQ3SharedObject;
  164. typedef TQ3Object                TQ3ViewObject;
  165. typedef TQ3Object                TQ3PickObject;
  166.  
  167. /*
  168.  * There are several types of SharedObjects:
  169.  *    RENDERERs, which paint to a drawContext
  170.  *    DRAWCONTEXTs, which are an interface to a device 
  171.  *    SETs, which maintains "mathematical sets" of ELEMENTs
  172.  *    FILEs, which maintain state information for a metafile
  173.  *    SHAPEs, which affect the state of the View
  174.  *    SHAPEPARTs, which contain geometry-specific data about a picking hit
  175.  *    CONTROLLERSTATEs, which hold state of the output channels for a CONTROLLER
  176.  *    TRACKERs, which represent a position and orientation in the user interface
  177.  *  STRINGs, which are abstractions of text string data.
  178.  *    STORAGE, which is an abstraction for stream-based data storage (files, 
  179.  *        memory)
  180.  *    TEXTUREs, for sharing bitmap information for TEXTURESHADERS
  181.  *    VIEWHINTs, which specifies viewing preferences in FILEs
  182.  */
  183. typedef TQ3SharedObject            TQ3RendererObject;
  184. typedef TQ3SharedObject            TQ3DrawContextObject;
  185. typedef TQ3SharedObject            TQ3SetObject;
  186. typedef TQ3SharedObject            TQ3FileObject;
  187. typedef TQ3SharedObject            TQ3ShapeObject;
  188. typedef TQ3SharedObject            TQ3ShapePartObject;
  189. typedef TQ3SharedObject            TQ3ControllerStateObject;
  190. typedef TQ3SharedObject            TQ3TrackerObject;
  191. typedef TQ3SharedObject            TQ3StringObject;
  192. typedef TQ3SharedObject            TQ3StorageObject;
  193. typedef TQ3SharedObject            TQ3TextureObject;
  194. typedef TQ3SharedObject            TQ3ViewHintsObject;
  195.  
  196.  
  197. /*
  198.  * There is one types of SET:
  199.  *    ATTRIBUTESETs, which contain ATTRIBUTEs which are inherited 
  200.  */
  201. typedef TQ3SetObject                TQ3AttributeSet;
  202.  
  203. /*
  204.  * There are many types of SHAPEs:
  205.  *    LIGHTs, which affect how the RENDERER draws 3-D cues
  206.  *    CAMERAs, which affects the location and orientation of the RENDERER in 
  207.  *        space
  208.  *    GROUPs, which may contain any number of SHARED OBJECTS
  209.  *    GEOMETRYs, which are representations of three-dimensional data
  210.  *    SHADERs, which affect how colors are drawn on a geometry
  211.  *    STYLEs, which affect how the RENDERER paints to the DRAWCONTEXT
  212.  *    TRANSFORMs, which affect the coordinate system in the VIEW
  213.  *    REFERENCEs, which are references to objects in FILEs
  214.  *  UNKNOWN, which hold unknown objects read from a metafile.
  215.  */
  216. typedef TQ3ShapeObject            TQ3GroupObject;
  217. typedef TQ3ShapeObject            TQ3GeometryObject;
  218. typedef TQ3ShapeObject            TQ3ShaderObject;
  219. typedef TQ3ShapeObject            TQ3StyleObject;
  220. typedef TQ3ShapeObject            TQ3TransformObject;
  221. typedef TQ3ShapeObject            TQ3LightObject;
  222. typedef TQ3ShapeObject            TQ3CameraObject;
  223. typedef TQ3ShapeObject            TQ3UnknownObject;
  224. typedef TQ3ShapeObject            TQ3ReferenceObject;
  225.  
  226. /*
  227.  * For now, there is only one type of SHAPEPARTs:
  228.  *    MESHPARTs, which describe some part of a mesh
  229.  */
  230. typedef TQ3ShapePartObject        TQ3MeshPartObject;
  231.  
  232. /*
  233.  * There are three types of MESHPARTs:
  234.  *    MESHFACEPARTs, which describe a face of a mesh
  235.  *    MESHEDGEPARTs, which describe a edge of a mesh
  236.  *    MESHVERTEXPARTs, which describe a vertex of a mesh
  237.  */
  238. typedef TQ3MeshPartObject        TQ3MeshFacePartObject;
  239. typedef TQ3MeshPartObject        TQ3MeshEdgePartObject;
  240. typedef TQ3MeshPartObject        TQ3MeshVertexPartObject;
  241.  
  242. /*
  243.  * A DISPLAY Group can be drawn to a view
  244.  */
  245. typedef TQ3GroupObject            TQ3DisplayGroupObject;
  246.  
  247. /*
  248.  * There are many types of SHADERs:
  249.  *    SURFACESHADERs, which affect how the surface of a geometry is painted
  250.  *    ILLUMINATIONSHADERs, which affect how lights affect the color of a surface
  251.  */
  252. typedef TQ3ShaderObject            TQ3SurfaceShaderObject;
  253. typedef TQ3ShaderObject            TQ3IlluminationShaderObject;
  254.  
  255. /*
  256.  * A handle to an object in a group
  257.  */
  258. typedef struct TQ3GroupPositionPrivate    *TQ3GroupPosition;
  259.  
  260. /* 
  261.  * TQ3ObjectClassNameString is used for the class name of an object
  262.  */
  263. enum {
  264.     kQ3StringMaximumLength = 1024
  265. };
  266.  
  267. typedef char TQ3ObjectClassNameString[kQ3StringMaximumLength];
  268.  
  269.  
  270. /******************************************************************************
  271.  **                                                                             **
  272.  **                            Client/Server Things                             **
  273.  **                                                                             **
  274.  *****************************************************************************/
  275.  
  276. typedef void *TQ3ControllerRef;
  277.  
  278.  
  279. /******************************************************************************
  280.  **                                                                             **
  281.  **                            Flags and Switches                                 **
  282.  **                                                                             **
  283.  *****************************************************************************/
  284.  
  285. typedef enum TQ3Boolean {
  286.     kQ3False,
  287.     kQ3True
  288. } TQ3Boolean;
  289.  
  290. typedef enum TQ3Switch {
  291.     kQ3Off,
  292.     kQ3On
  293. } TQ3Switch;
  294.  
  295. typedef enum TQ3Status {
  296.     kQ3Failure,
  297.     kQ3Success
  298. } TQ3Status;
  299.  
  300. typedef enum TQ3Axis {
  301.     kQ3AxisX,
  302.     kQ3AxisY,
  303.     kQ3AxisZ
  304. } TQ3Axis;
  305.  
  306. typedef enum TQ3PixelType {
  307.     kQ3PixelTypeRGB32        = 0,    /* Alpha:8 (ignored), R:8, G:8, B:8    */
  308.     kQ3PixelTypeARGB32        = 1,    /* Alpha:8, R:8, G:8, B:8             */
  309.     kQ3PixelTypeRGB16        = 2,    /* Alpha:1 (ignored), R:5, G:5, B:5    */
  310.     kQ3PixelTypeARGB16        = 3        /* Alpha:1, R:5, G:5, B:5             */
  311. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  312.     ,
  313.     kQ3PixelTypeRGB16_565    = 4,    /* 16 bits/pixel, R:5, G:6, B:5        */
  314.     kQ3PixelTypeRGB24        = 5        /* 24 bits/pixel, R:8, G:8, B:8        */
  315. #endif /* WINDOW_SYSTEM_WIN32 */
  316. } TQ3PixelType;
  317.  
  318. typedef enum TQ3Endian{
  319.     kQ3EndianBig,
  320.     kQ3EndianLittle
  321. } TQ3Endian;
  322.  
  323. typedef enum TQ3EndCapMasks {
  324.     kQ3EndCapNone            = 0,
  325.     kQ3EndCapMaskTop        = 1 << 0,
  326.     kQ3EndCapMaskBottom        = 1 << 1,
  327.     kQ3EndCapMaskInterior    = 1 << 2
  328. } TQ3EndCapMasks;
  329.  
  330. typedef unsigned long TQ3EndCap;
  331.  
  332. enum {
  333.     kQ3ArrayIndexNULL = ~0
  334. };
  335.  
  336.  
  337. /******************************************************************************
  338.  **                                                                             **
  339.  **                        Point and Vector Definitions                         **
  340.  **                                                                             **
  341.  *****************************************************************************/
  342.  
  343. typedef struct TQ3Vector2D {
  344.     float        x;
  345.     float        y;
  346. } TQ3Vector2D;
  347.  
  348. typedef struct TQ3Vector3D {
  349.     float         x;
  350.     float        y;
  351.     float        z;
  352. } TQ3Vector3D;
  353.  
  354. typedef struct TQ3Point2D {
  355.     float        x;
  356.     float        y;
  357. } TQ3Point2D;
  358.  
  359. typedef struct TQ3Point3D {
  360.     float         x;
  361.     float        y;
  362.     float        z;
  363. } TQ3Point3D;
  364.  
  365. typedef struct TQ3RationalPoint4D {
  366.     float         x;
  367.     float        y;
  368.     float        z;
  369.     float        w;
  370. } TQ3RationalPoint4D;
  371.  
  372. typedef struct TQ3RationalPoint3D {
  373.     float        x;
  374.     float        y;
  375.     float        w;
  376. } TQ3RationalPoint3D;
  377.  
  378.  
  379. /******************************************************************************
  380.  **                                                                             **
  381.  **                                Quaternion                                     **
  382.  **                                                                             **
  383.  *****************************************************************************/
  384.  
  385. typedef struct TQ3Quaternion {
  386.     float        w;
  387.     float        x;
  388.     float        y;
  389.     float        z;
  390. } TQ3Quaternion;
  391.  
  392.  
  393. /******************************************************************************
  394.  **                                                                             **
  395.  **                                Ray Definition                                 **
  396.  **                                                                             **
  397.  *****************************************************************************/
  398.  
  399. typedef struct TQ3Ray3D {
  400.     TQ3Point3D        origin;
  401.     TQ3Vector3D        direction;
  402. } TQ3Ray3D;
  403.  
  404.  
  405. /******************************************************************************
  406.  **                                                                             **
  407.  **                        Parameterization Data Structures                     **
  408.  **                                                                             **
  409.  *****************************************************************************/
  410.  
  411. typedef struct TQ3Param2D {
  412.     float            u;
  413.     float            v;
  414. } TQ3Param2D;
  415.  
  416. typedef struct TQ3Param3D {
  417.     float            u;
  418.     float            v;
  419.     float            w;
  420. } TQ3Param3D;
  421.  
  422. typedef struct TQ3Tangent2D {
  423.     TQ3Vector3D        uTangent;
  424.     TQ3Vector3D        vTangent;
  425. } TQ3Tangent2D;
  426.  
  427. typedef struct TQ3Tangent3D {
  428.     TQ3Vector3D        uTangent;
  429.     TQ3Vector3D        vTangent;
  430.     TQ3Vector3D        wTangent;
  431. } TQ3Tangent3D;
  432.  
  433.  
  434. /******************************************************************************
  435.  **                                                                             **
  436.  **                        Polar and Spherical Coordinates                         **
  437.  **                                                                             **
  438.  *****************************************************************************/
  439.  
  440.  typedef struct TQ3PolarPoint {
  441.      float        r;
  442.      float        theta;
  443.   } TQ3PolarPoint;
  444.  
  445.  typedef struct TQ3SphericalPoint {
  446.      float        rho;
  447.      float        theta;
  448.      float        phi;
  449.  } TQ3SphericalPoint;
  450.  
  451.  
  452. /******************************************************************************
  453.  **                                                                             **
  454.  **                            Color Definition                                 **
  455.  **                                                                             **
  456.  *****************************************************************************/
  457.  
  458. typedef struct TQ3ColorRGB {
  459.     float             r;
  460.     float            g;
  461.     float            b;
  462. } TQ3ColorRGB;
  463.  
  464.  
  465. typedef struct TQ3ColorARGB {
  466.     float             a;
  467.     float             r;
  468.     float            g;
  469.     float            b;
  470. } TQ3ColorARGB;
  471.  
  472.  
  473. /******************************************************************************
  474.  **                                                                             **
  475.  **                                    Vertices                                 **
  476.  **                                                                             **
  477.  *****************************************************************************/
  478.  
  479. typedef struct TQ3Vertex3D {
  480.     TQ3Point3D            point;
  481.     TQ3AttributeSet        attributeSet;
  482. }  TQ3Vertex3D;
  483.  
  484.  
  485. /******************************************************************************
  486.  **                                                                             **
  487.  **                                    Matrices                                 **
  488.  **                                                                             **
  489.  *****************************************************************************/
  490.  
  491. typedef struct TQ3Matrix3x3 {
  492.     float    value[3][3];
  493. } TQ3Matrix3x3;
  494.  
  495. typedef struct TQ3Matrix4x4 {
  496.     float    value[4][4];
  497. } TQ3Matrix4x4;
  498.  
  499.  
  500.  
  501.  
  502. /******************************************************************************
  503.  **                                                                             **
  504.  **                                Bitmap/Pixmap                                 **
  505.  **                                                                             **
  506.  *****************************************************************************/
  507.  
  508. typedef struct TQ3Pixmap {
  509.     void                *image;
  510.     unsigned long        width;
  511.     unsigned long        height;
  512.     unsigned long        rowBytes;
  513.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the         */
  514.                                     /* Interactive Renderer on Mac OS         */
  515.     TQ3PixelType        pixelType;
  516.     TQ3Endian            bitOrder;
  517.     TQ3Endian            byteOrder;
  518. } TQ3Pixmap;
  519.  
  520. typedef struct TQ3StoragePixmap {
  521.     TQ3StorageObject    image;
  522.     unsigned long        width;
  523.     unsigned long        height;
  524.     unsigned long        rowBytes;
  525.     unsigned long        pixelSize;    /* MUST be 16 or 32 to use with the     */
  526.                                     /* Interactive Renderer on Mac OS        */
  527.     TQ3PixelType        pixelType;
  528.     TQ3Endian            bitOrder;
  529.     TQ3Endian            byteOrder;
  530. } TQ3StoragePixmap;
  531.  
  532. typedef struct TQ3Bitmap {
  533.     unsigned char        *image;
  534.     unsigned long        width;
  535.     unsigned long        height;
  536.     unsigned long        rowBytes;
  537.     TQ3Endian            bitOrder;
  538. } TQ3Bitmap;
  539.  
  540. typedef struct TQ3MipmapImage {        /* An image for use as a texture mipmap  */
  541.     unsigned long        width;        /* Width of mipmap, must be power of 2   */
  542.     unsigned long        height;        /* Height of mipmap, must be power of 2  */
  543.     unsigned long        rowBytes;    /* Rowbytes of mipmap                    */
  544.     unsigned long        offset;        /* Offset from image base to this mipmap */
  545. } TQ3MipmapImage;
  546.  
  547. typedef struct TQ3Mipmap {
  548.     TQ3StorageObject    image;        /* Data containing the texture map and     */
  549.                                     /* if (useMipmapping==kQ3True) the         */
  550.                                     /* mipmap data                             */
  551.     TQ3Boolean            useMipmapping;/* True if mipmapping should be used     */
  552.                                     /* and all mipmaps have been provided   */
  553.     TQ3PixelType        pixelType;
  554.     TQ3Endian            bitOrder;
  555.     TQ3Endian            byteOrder;
  556.     unsigned long        reserved;    /* leave NULL for next version */
  557.     TQ3MipmapImage        mipmaps[32];/* The actual number of mipmaps is         */
  558.                                     /* determined from the size of the         */
  559.                                     /* first mipmap                            */
  560. } TQ3Mipmap;
  561.  
  562.  
  563. /******************************************************************************
  564.  **                                                                             **
  565.  **                        Higher dimension quantities                             **
  566.  **                                                                             **
  567.  *****************************************************************************/
  568.  
  569. typedef struct TQ3Area {
  570.     TQ3Point2D             min;
  571.     TQ3Point2D             max;
  572. } TQ3Area;
  573.  
  574. typedef struct TQ3PlaneEquation {
  575.     TQ3Vector3D            normal;
  576.     float                constant;
  577. } TQ3PlaneEquation;
  578.  
  579. typedef struct TQ3BoundingBox {
  580.     TQ3Point3D             min;
  581.     TQ3Point3D             max;
  582.     TQ3Boolean            isEmpty;
  583. } TQ3BoundingBox;
  584.  
  585. typedef struct TQ3BoundingSphere {
  586.     TQ3Point3D            origin;
  587.     float                radius;
  588.     TQ3Boolean            isEmpty;
  589. } TQ3BoundingSphere;
  590.  
  591. /*
  592.  *    The TQ3ComputeBounds flag passed to StartBoundingBox or StartBoundingSphere
  593.  *    calls in the View. It's a hint to the system as to how it should 
  594.  *    compute the bbox of a shape:
  595.  *
  596.  *    kQ3ComputeBoundsExact:    
  597.  *        Vertices of shapes are transformed into world space and
  598.  *        the world space bounding box is computed from them.  Slow!
  599.  *    
  600.  *    kQ3ComputeBoundsApproximate: 
  601.  *        A local space bounding box is computed from a shape's
  602.  *        vertices.  This bbox is then transformed into world space,
  603.  *        and its bounding box is taken as the shape's approximate
  604.  *        bbox.  Fast but the bbox is larger than optimal.
  605.  */
  606. typedef enum TQ3ComputeBounds {
  607.     kQ3ComputeBoundsExact,
  608.     kQ3ComputeBoundsApproximate
  609. } TQ3ComputeBounds;
  610.  
  611.  
  612. /******************************************************************************
  613.  **                                                                             **
  614.  **                            Object System Types                                 **
  615.  **                                                                             **
  616.  *****************************************************************************/
  617.  
  618.  
  619.  
  620. typedef struct TQ3ObjectClassPrivate        *TQ3XObjectClass;
  621.  
  622. typedef unsigned long                         TQ3XMethodType;
  623.  
  624. /*
  625.  *  Object methods
  626.  */
  627. #define kQ3XMethodTypeObjectUnregister        Q3_METHOD_TYPE('u','n','r','g')
  628.  
  629. /* 
  630.  *  Return true from the metahandler if this 
  631.  *  object can be submitted in a rendering loop 
  632.  */
  633. #define kQ3XMethodTypeObjectIsDrawable        Q3_METHOD_TYPE('i','s','d','r')    
  634.  
  635. typedef void (QD3D_CALLBACK *TQ3XFunctionPointer)(
  636.     void);
  637.  
  638. typedef TQ3XFunctionPointer (QD3D_CALLBACK *TQ3XMetaHandler)(
  639.     TQ3XMethodType        methodType);
  640.  
  641. /*
  642.  * MetaHandler:
  643.  *        When you give a metahandler to QuickDraw 3D, it is called multiple 
  644.  *        times to build method tables, and then is thrown away. You are 
  645.  *        guaranteed that your metahandler will never be called again after a 
  646.  *        call that was passed a metahandler returns.
  647.  *
  648.  *        Your metahandler should contain a switch on the methodType passed to it
  649.  *        and should return the corresponding method as an TQ3XFunctionPointer.
  650.  *
  651.  *        IMPORTANT: A metaHandler MUST always "return" a value. If you are
  652.  *        passed a methodType that you do not understand, ALWAYS return NULL.
  653.  *
  654.  *        These types here are prototypes of how your functions should look.
  655.  */
  656. typedef TQ3Status (QD3D_CALLBACK *TQ3XObjectUnregisterMethod)(
  657.     TQ3XObjectClass        objectClass);
  658.     
  659. /*
  660.  * See QD3DIO.h for the IO method types: 
  661.  *        ObjectReadData, ObjectTraverse, ObjectWrite
  662.  */
  663.  
  664.  
  665. /******************************************************************************
  666.  **                                                                             **
  667.  **                                Set Types                                     **
  668.  **                                                                             **
  669.  *****************************************************************************/
  670.  
  671. typedef long                    TQ3ElementType;
  672.  
  673. #define kQ3ElementTypeNone        0
  674. #define kQ3ElementTypeUnknown    32
  675. #define kQ3ElementTypeSet        33
  676.  
  677. /* 
  678.  *    kQ3ElementTypeUnknown is a TQ3Object. 
  679.  *    
  680.  *        Do Q3Set_Add(s, ..., &obj) or Q3Set_Get(s, ..., &obj);
  681.  *        
  682.  *        Note that the object is always referenced when copying around. 
  683.  *        
  684.  *        Generally, it is an Unknown object, a Group of Unknown objects, or a 
  685.  *        group of other "objects" which have been found in the metafile and
  686.  *        have no attachment method to their parent. Be prepared to handle
  687.  *        any or all of these cases if you actually access the set on a shape.
  688.  *
  689.  *    kQ3ElementTypeSet is a TQ3SetObject. 
  690.  *    
  691.  *        Q3Shape_GetSet(s,&o) is eqivalent to 
  692.  *            Q3Shape_GetElement(s, kQ3ElementTypeSet, &o)
  693.  *            
  694.  *        Q3Shape_SetSet(s,o)  is eqivalent to 
  695.  *            Q3Shape_SetElement(s, kQ3ElementTypeSet, &o)
  696.  *    
  697.  *        Note that the object is always referenced when copying around. 
  698.  *        
  699.  *    See the note below about the Set and Shape changes.
  700.  */
  701.  
  702. /******************************************************************************
  703.  **                                                                             **
  704.  **                            Object System Macros                             **
  705.  **                                                                             **
  706.  *****************************************************************************/
  707.  
  708. #define Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d)         \
  709.             ((const unsigned long)                     \
  710.             ((const unsigned long) (a) << 24) |     \
  711.             ((const unsigned long) (b) << 16) |        \
  712.             ((const unsigned long) (c) << 8)  |     \
  713.             ((const unsigned long) (d)))
  714.  
  715. #define Q3_OBJECT_TYPE(a,b,c,d) \
  716.     ((TQ3ObjectType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  717.  
  718. #define Q3_METHOD_TYPE(a,b,c,d) \
  719.     ((TQ3XMethodType) Q3_FOUR_CHARACTER_CONSTANT(a,b,c,d))
  720.  
  721.  
  722.  
  723. /******************************************************************************
  724.  **                                                                             **
  725.  **                                Object Types                                 **
  726.  **                                                                             **
  727.  *****************************************************************************/
  728.  
  729. /*
  730.  * Note:    a call to Q3Foo_GetType will return a value kQ3FooTypeBar
  731.  *            e.g. Q3Shared_GetType(object) returns kQ3SharedTypeShape, etc.
  732.  */
  733. #define kQ3ObjectTypeInvalid                            0L
  734. #define kQ3ObjectTypeView                                Q3_OBJECT_TYPE('v','i','e','w')
  735. #define kQ3ObjectTypeElement                            Q3_OBJECT_TYPE('e','l','m','n')
  736.     #define kQ3ElementTypeAttribute                        Q3_OBJECT_TYPE('e','a','t','t')
  737. #define kQ3ObjectTypePick                                Q3_OBJECT_TYPE('p','i','c','k')
  738.     #define kQ3PickTypeWindowPoint                        Q3_OBJECT_TYPE('p','k','w','p')
  739.     #define kQ3PickTypeWindowRect                        Q3_OBJECT_TYPE('p','k','w','r')
  740. #define kQ3ObjectTypeShared                                Q3_OBJECT_TYPE('s','h','r','d')
  741.     #define kQ3SharedTypeRenderer                        Q3_OBJECT_TYPE('r','d','d','r')
  742.         #define kQ3RendererTypeWireFrame                Q3_OBJECT_TYPE('w','r','f','r')
  743.         #define kQ3RendererTypeGeneric                    Q3_OBJECT_TYPE('g','n','r','r')
  744.         #define kQ3RendererTypeInteractive                Q3_OBJECT_TYPE('c','t','w','n')
  745.     #define kQ3SharedTypeShape                            Q3_OBJECT_TYPE('s','h','a','p')
  746.         #define kQ3ShapeTypeGeometry                    Q3_OBJECT_TYPE('g','m','t','r')
  747.             #define kQ3GeometryTypeBox                    Q3_OBJECT_TYPE('b','o','x',' ')
  748.             #define kQ3GeometryTypeGeneralPolygon        Q3_OBJECT_TYPE('g','p','g','n')
  749.             #define kQ3GeometryTypeLine                    Q3_OBJECT_TYPE('l','i','n','e')
  750.             #define kQ3GeometryTypeMarker                Q3_OBJECT_TYPE('m','r','k','r')
  751.             #define kQ3GeometryTypePixmapMarker            Q3_OBJECT_TYPE('m','r','k','p')
  752.             #define kQ3GeometryTypeMesh                    Q3_OBJECT_TYPE('m','e','s','h')
  753.             #define kQ3GeometryTypeNURBCurve            Q3_OBJECT_TYPE('n','r','b','c')
  754.             #define kQ3GeometryTypeNURBPatch            Q3_OBJECT_TYPE('n','r','b','p')
  755.             #define kQ3GeometryTypePoint                Q3_OBJECT_TYPE('p','n','t',' ')
  756.             #define kQ3GeometryTypePolygon                Q3_OBJECT_TYPE('p','l','y','g')
  757.             #define kQ3GeometryTypePolyLine                Q3_OBJECT_TYPE('p','l','y','l')
  758.             #define kQ3GeometryTypeTriangle                Q3_OBJECT_TYPE('t','r','n','g')
  759.             #define kQ3GeometryTypeTriGrid                Q3_OBJECT_TYPE('t','r','i','g')
  760.             #define kQ3GeometryTypeCone                    Q3_OBJECT_TYPE('c','o','n','e')
  761.             #define kQ3GeometryTypeCylinder                Q3_OBJECT_TYPE('c','y','l','n')
  762.             #define kQ3GeometryTypeDisk                    Q3_OBJECT_TYPE('d','i','s','k')
  763.             #define kQ3GeometryTypeEllipse                Q3_OBJECT_TYPE('e','l','p','s')
  764.             #define kQ3GeometryTypeEllipsoid            Q3_OBJECT_TYPE('e','l','p','d')
  765.             #define kQ3GeometryTypePolyhedron            Q3_OBJECT_TYPE('p','l','h','d')
  766.             #define kQ3GeometryTypeTorus                Q3_OBJECT_TYPE('t','o','r','s')
  767.             #define kQ3GeometryTypeTriMesh                Q3_OBJECT_TYPE('t','m','s','h')
  768.         #define kQ3ShapeTypeShader                        Q3_OBJECT_TYPE('s','h','d','r')
  769.             #define kQ3ShaderTypeSurface                Q3_OBJECT_TYPE('s','u','s','h')
  770.                 #define kQ3SurfaceShaderTypeTexture        Q3_OBJECT_TYPE('t','x','s','u')
  771.             #define kQ3ShaderTypeIllumination            Q3_OBJECT_TYPE('i','l','s','h')
  772.                 #define kQ3IlluminationTypePhong        Q3_OBJECT_TYPE('p','h','i','l')
  773.                 #define kQ3IlluminationTypeLambert        Q3_OBJECT_TYPE('l','m','i','l')
  774.                 #define kQ3IlluminationTypeNULL            Q3_OBJECT_TYPE('n','u','i','l')
  775.         #define kQ3ShapeTypeStyle                        Q3_OBJECT_TYPE('s','t','y','l')
  776.             #define kQ3StyleTypeBackfacing                Q3_OBJECT_TYPE('b','c','k','f')
  777.             #define kQ3StyleTypeInterpolation            Q3_OBJECT_TYPE('i','n','t','p')
  778.             #define kQ3StyleTypeFill                    Q3_OBJECT_TYPE('f','i','s','t')
  779.             #define kQ3StyleTypePickID                    Q3_OBJECT_TYPE('p','k','i','d')
  780.             #define kQ3StyleTypeReceiveShadows            Q3_OBJECT_TYPE('r','c','s','h')
  781.             #define kQ3StyleTypeHighlight                Q3_OBJECT_TYPE('h','i','g','h')
  782.             #define kQ3StyleTypeSubdivision                Q3_OBJECT_TYPE('s','b','d','v')
  783.             #define kQ3StyleTypeOrientation                Q3_OBJECT_TYPE('o','f','d','r')
  784.             #define kQ3StyleTypePickParts                Q3_OBJECT_TYPE('p','k','p','t')
  785.             #define kQ3StyleTypeAntiAlias                Q3_OBJECT_TYPE('a','n','t','i')
  786.         #define kQ3ShapeTypeTransform                    Q3_OBJECT_TYPE('x','f','r','m')
  787.             #define kQ3TransformTypeMatrix                Q3_OBJECT_TYPE('m','t','r','x')
  788.             #define kQ3TransformTypeScale                Q3_OBJECT_TYPE('s','c','a','l')
  789.             #define kQ3TransformTypeTranslate            Q3_OBJECT_TYPE('t','r','n','s')
  790.             #define kQ3TransformTypeRotate                Q3_OBJECT_TYPE('r','o','t','t')
  791.             #define kQ3TransformTypeRotateAboutPoint     Q3_OBJECT_TYPE('r','t','a','p')
  792.             #define kQ3TransformTypeRotateAboutAxis     Q3_OBJECT_TYPE('r','t','a','a')
  793.             #define kQ3TransformTypeQuaternion            Q3_OBJECT_TYPE('q','t','r','n')
  794.             #define kQ3TransformTypeReset                Q3_OBJECT_TYPE('r','s','e','t')
  795.         #define kQ3ShapeTypeLight                        Q3_OBJECT_TYPE('l','g','h','t')
  796.             #define kQ3LightTypeAmbient                    Q3_OBJECT_TYPE('a','m','b','n')
  797.             #define kQ3LightTypeDirectional                Q3_OBJECT_TYPE('d','r','c','t')
  798.             #define kQ3LightTypePoint                    Q3_OBJECT_TYPE('p','n','t','l')
  799.             #define kQ3LightTypeSpot                    Q3_OBJECT_TYPE('s','p','o','t')
  800.         #define kQ3ShapeTypeCamera                        Q3_OBJECT_TYPE('c','m','r','a')
  801.             #define kQ3CameraTypeOrthographic            Q3_OBJECT_TYPE('o','r','t','h')
  802.             #define kQ3CameraTypeViewPlane                Q3_OBJECT_TYPE('v','w','p','l')
  803.             #define kQ3CameraTypeViewAngleAspect        Q3_OBJECT_TYPE('v','a','n','a')
  804.         
  805.         #define kQ3ShapeTypeGroup                        Q3_OBJECT_TYPE('g','r','u','p')
  806.             #define kQ3GroupTypeDisplay                    Q3_OBJECT_TYPE('d','s','p','g')
  807.                 #define kQ3DisplayGroupTypeOrdered        Q3_OBJECT_TYPE('o','r','d','g')
  808.                 #define kQ3DisplayGroupTypeIOProxy        Q3_OBJECT_TYPE('i','o','p','x')
  809.             #define kQ3GroupTypeLight                    Q3_OBJECT_TYPE('l','g','h','g')
  810.             #define kQ3GroupTypeInfo                    Q3_OBJECT_TYPE('i','n','f','o')
  811.         #define kQ3ShapeTypeUnknown                        Q3_OBJECT_TYPE('u','n','k','n')
  812.             #define kQ3UnknownTypeText                    Q3_OBJECT_TYPE('u','k','t','x')
  813.             #define kQ3UnknownTypeBinary                Q3_OBJECT_TYPE('u','k','b','n')
  814.         #define kQ3ShapeTypeReference                    Q3_OBJECT_TYPE('r','f','r','n')
  815.             #define kQ3ReferenceTypeExternal            Q3_OBJECT_TYPE('r','f','e','x')
  816.     #define kQ3SharedTypeSet                            Q3_OBJECT_TYPE('s','e','t',' ')
  817.         #define kQ3SetTypeAttribute                        Q3_OBJECT_TYPE('a','t','t','r')
  818.     #define kQ3SharedTypeDrawContext                    Q3_OBJECT_TYPE('d','c','t','x')
  819.         #define kQ3DrawContextTypePixmap                Q3_OBJECT_TYPE('d','p','x','p')
  820.         #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  821.         #define kQ3DrawContextTypeMacintosh                Q3_OBJECT_TYPE('d','m','a','c')
  822.         #endif  /*  WINDOW_SYSTEM_MACINTOSH  */
  823.         #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  824.         #define kQ3DrawContextTypeWin32DC                Q3_OBJECT_TYPE('d','w','3','2')
  825.         #define kQ3DrawContextTypeDDSurface                Q3_OBJECT_TYPE('d','d','d','s')
  826.         #endif  /*  WINDOW_SYSTEM_WIN32  */
  827.         #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  828.         #define kQ3DrawContextTypeX11                    Q3_OBJECT_TYPE('d','x','1','1')
  829.         #endif  /*  WINDOW_SYSTEM_X11  */
  830.     #define kQ3SharedTypeTexture                        Q3_OBJECT_TYPE('t','x','t','r')
  831.         #define kQ3TextureTypePixmap                    Q3_OBJECT_TYPE('t','x','p','m')
  832.         #define kQ3TextureTypeMipmap                    Q3_OBJECT_TYPE('t','x','m','m')
  833.     #define kQ3SharedTypeFile                            Q3_OBJECT_TYPE('f','i','l','e')
  834.     #define kQ3SharedTypeStorage                        Q3_OBJECT_TYPE('s','t','r','g')
  835.         #define kQ3StorageTypeMemory                    Q3_OBJECT_TYPE('m','e','m','s')
  836.             #if defined(OS_MACINTOSH) && OS_MACINTOSH
  837.             #define kQ3MemoryStorageTypeHandle            Q3_OBJECT_TYPE('h','n','d','l')
  838.             #endif  /*  OS_MACINTOSH  */
  839.         #define kQ3StorageTypeUnix                        Q3_OBJECT_TYPE('u','x','s','t')
  840.             #define kQ3UnixStorageTypePath                Q3_OBJECT_TYPE('u','n','i','x')
  841.         #if defined(OS_MACINTOSH) && OS_MACINTOSH
  842.         #define kQ3StorageTypeMacintosh                    Q3_OBJECT_TYPE('m','a','c','n')
  843.             #define kQ3MacintoshStorageTypeFSSpec        Q3_OBJECT_TYPE('m','a','c','p')                    
  844.         #endif  /*  OS_MACINTOSH  */
  845.         #if defined(OS_WIN32) && OS_WIN32
  846.         #define kQ3StorageTypeWin32                        Q3_OBJECT_TYPE('w','i','s','t')
  847.         #endif  /*  OS_WIN32  */
  848.     #define kQ3SharedTypeString                            Q3_OBJECT_TYPE('s','t','r','n')
  849.         #define kQ3StringTypeCString                    Q3_OBJECT_TYPE('s','t','r','c')
  850.     #define kQ3SharedTypeShapePart                        Q3_OBJECT_TYPE('s','p','r','t')
  851.         #define kQ3ShapePartTypeMeshPart                Q3_OBJECT_TYPE('s','p','m','h')
  852.             #define kQ3MeshPartTypeMeshFacePart            Q3_OBJECT_TYPE('m','f','a','c')
  853.             #define kQ3MeshPartTypeMeshEdgePart            Q3_OBJECT_TYPE('m','e','d','g')
  854.             #define kQ3MeshPartTypeMeshVertexPart        Q3_OBJECT_TYPE('m','v','t','x')
  855.     #define kQ3SharedTypeControllerState                Q3_OBJECT_TYPE('c','t','s','t')
  856.     #define kQ3SharedTypeTracker                        Q3_OBJECT_TYPE('t','r','k','r')
  857.     #define kQ3SharedTypeViewHints                        Q3_OBJECT_TYPE('v','w','h','n')
  858.     #define kQ3SharedTypeEndGroup                        Q3_OBJECT_TYPE('e','n','d','g')
  859.  
  860.  
  861. /******************************************************************************
  862.  **                                                                             **
  863.  **                            QuickDraw 3D System Routines                     **
  864.  **                                                                             **
  865.  *****************************************************************************/
  866.  
  867. QD3D_EXPORT TQ3Status QD3D_CALL Q3Initialize(
  868.     void);
  869.  
  870. QD3D_EXPORT TQ3Status QD3D_CALL Q3Exit(
  871.     void);
  872.  
  873. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3IsInitialized(
  874.     void);
  875.  
  876. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetVersion(
  877.     unsigned long        *majorRevision,
  878.     unsigned long        *minorRevision);
  879.  
  880. /*
  881.  *  Q3GetReleaseVersion returns the release version number,
  882.  *  in the format of the first four bytes of a 'vers' resource
  883.  *  (e.g. 0x01518000 ==> 1.5.1 release).
  884.  */
  885. QD3D_EXPORT TQ3Status QD3D_CALL Q3GetReleaseVersion(
  886.     unsigned long        *releaseRevision);
  887.  
  888.  
  889. /******************************************************************************
  890.  **                                                                             **
  891.  **                            ObjectClass Routines                             **
  892.  **                                                                             **
  893.  *****************************************************************************/
  894.  
  895.  
  896. /* 
  897.  *  New object system calls to query the object system.
  898.  *
  899.  *  These comments to move to the stubs file before final release, they 
  900.  *  are here for documentation for developers using early seeds.
  901.  */
  902.  
  903. /*
  904.  *  Given a class name as a string return the associated class type for the 
  905.  *  class, may return kQ3Failure if the string representing the class is 
  906.  *  invalid.
  907.  */
  908. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetTypeFromString(
  909.     TQ3ObjectClassNameString    objectClassString, 
  910.     TQ3ObjectType                 *objectClassType);
  911.     
  912. /*
  913.  *  Given a class type as return the associated string for the class name, 
  914.  *  may return kQ3Failure if the type representing the class is invalid.
  915.  */
  916. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetStringFromType(
  917.     TQ3ObjectType                objectClassType, 
  918.     TQ3ObjectClassNameString     objectClassString);
  919.  
  920. /* 
  921.  *  Return true if the class with this type is registered, false if not 
  922.  */
  923. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsTypeRegistered(
  924.     TQ3ObjectType                objectClassType);
  925.  
  926. /* 
  927.  *  Return true if the class with this name is registered, false if not 
  928.  */
  929. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3ObjectHierarchy_IsNameRegistered(
  930.     const char                    *objectClassName);
  931.  
  932. /*
  933.  * TQ3SubClassData is used when querying the object system for
  934.  * the subclasses of a particular parent type:
  935.  */
  936. typedef struct TQ3SubClassData {
  937.     unsigned long         numClasses;        /* the # of subclass types found */
  938.                                         /* for a parent class              */
  939.     TQ3ObjectType        *classTypes;    /* an array containing the class */
  940.                                         /* types                         */
  941. } TQ3SubClassData;
  942.  
  943. /*
  944.  *  Given a parent type and an instance of the TQ3SubClassData struct fill
  945.  *  it in with the number and class types of all of the subclasses immediately
  946.  *  below the parent in the class hierarchy.  Return kQ3Success to indicate no
  947.  *  errors occurred, else kQ3Failure.
  948.  *
  949.  *  NOTE:  This function will allocate memory for the classTypes array.  Be 
  950.  *    sure to call Q3ObjectClass_EmptySubClassData to free this memory up.
  951.  */
  952. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_GetSubClassData(
  953.     TQ3ObjectType                objectClassType, 
  954.     TQ3SubClassData                *subClassData);
  955.  
  956. /*
  957.  *  Given an instance of the TQ3SubClassData struct free all memory allocated 
  958.  *    by the Q3ObjectClass_GetSubClassData call.
  959.  *
  960.  *  NOTE: This call MUST be made after a call to Q3ObjectClass_GetSubClassData
  961.  *  to avoid memory leaks.
  962.  */
  963. QD3D_EXPORT TQ3Status QD3D_CALL Q3ObjectHierarchy_EmptySubClassData(
  964.     TQ3SubClassData                *subClassData);
  965.  
  966.  
  967. /******************************************************************************
  968.  **                                                                             **
  969.  **                                Object Routines                                 **
  970.  **                                                                             **
  971.  *****************************************************************************/
  972.  
  973. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Dispose(
  974.     TQ3Object             object);
  975.     
  976. QD3D_EXPORT TQ3Object QD3D_CALL Q3Object_Duplicate(
  977.     TQ3Object            object);
  978.     
  979. QD3D_EXPORT TQ3Status QD3D_CALL Q3Object_Submit(
  980.     TQ3Object            object,
  981.     TQ3ViewObject        view);
  982.     
  983. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsDrawable(
  984.     TQ3Object            object);
  985.  
  986. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsWritable(
  987.     TQ3Object            object,
  988.     TQ3FileObject        file);
  989.  
  990.  
  991. /******************************************************************************
  992.  **                                                                             **
  993.  **                            Object Type Routines                             **
  994.  **                                                                             **
  995.  *****************************************************************************/
  996.  
  997. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetType(
  998.     TQ3Object            object);
  999.  
  1000. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Object_GetLeafType(
  1001.     TQ3Object            object);
  1002.  
  1003. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Object_IsType(
  1004.     TQ3Object            object,
  1005.     TQ3ObjectType        type);
  1006.  
  1007.  
  1008. /******************************************************************************
  1009.  **                                                                             **
  1010.  **                            Shared Object Routines                             **
  1011.  **                                                                             **
  1012.  *****************************************************************************/
  1013.  
  1014. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shared_GetType(
  1015.     TQ3SharedObject     sharedObject);
  1016.  
  1017. QD3D_EXPORT TQ3SharedObject QD3D_CALL Q3Shared_GetReference(
  1018.     TQ3SharedObject     sharedObject);
  1019.  
  1020. /* 
  1021.  *    Q3Shared_IsReferenced
  1022.  *        Returns kQ3True if there is more than one reference to sharedObject.
  1023.  *        Returns kQ3False if there is ONE reference to sharedObject.
  1024.  *    
  1025.  *    This call is intended to allow applications and plug-in objects to delete
  1026.  *    objects of which they hold THE ONLY REFERENCE. This is useful when
  1027.  *    caching objects, etc.
  1028.  *    
  1029.  *    Although many may be tempted, DO NOT DO THIS:
  1030.  *        while (Q3Shared_IsReferenced(foo)) { Q3Object_Dispose(foo); }
  1031.  *    
  1032.  *    Your application will crash and no one will buy it. Chapter 11 is 
  1033.  *    never fun (unless you short the stock). Thanks.
  1034.  */
  1035. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shared_IsReferenced(
  1036.     TQ3SharedObject         sharedObject);
  1037.  
  1038. /*
  1039.  *    Q3Shared_GetEditIndex
  1040.  *        Returns the "serial number" of sharedObject. Usefuly for caching 
  1041.  *        object information. Returns 0 on error.
  1042.  *        
  1043.  *        Hold onto this number to determine if an object has changed since you
  1044.  *        last built your caches... To validate, do:
  1045.  *        
  1046.  *        if (Q3Shared_GetEditIndex(foo) == oldFooEditIndex) {
  1047.  *            // Cache is valid
  1048.  *        } else {
  1049.  *            // Cache is invalid
  1050.  *            RebuildSomeSortOfCache(foo);
  1051.  *            oldFooEditIndex = Q3Shared_GetEditIndex(foo);
  1052.  *        }
  1053.  */
  1054. QD3D_EXPORT unsigned long QD3D_CALL Q3Shared_GetEditIndex(
  1055.     TQ3SharedObject         sharedObject);
  1056.  
  1057. /*
  1058.  *    Q3Shared_Edited
  1059.  *        Bumps the "serial number" of sharedObject to a different value. This
  1060.  *        call is intended to be used solely from a plug-in object which is 
  1061.  *        shared. Call this whenever your private instance data changes.
  1062.  *        
  1063.  *        Returns kQ3Failure iff sharedObject is not a shared object, OR
  1064.  *            QuickDraw 3D isn't initialized.
  1065.  */
  1066. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shared_Edited(
  1067.     TQ3SharedObject         sharedObject);
  1068.  
  1069.  
  1070. /******************************************************************************
  1071.  **                                                                             **
  1072.  **                                Shape Routines                                 **
  1073.  **                                                                             **
  1074.  *****************************************************************************/
  1075.  
  1076. /*
  1077.  *    QuickDraw 3D 1.1 Note:
  1078.  *
  1079.  *    Shapes and Sets are now (sort of) polymorphic.
  1080.  *
  1081.  *        You may call Q3Shape_Foo or Q3Set_Foo on a shape or a set.
  1082.  *        The following calls are identical, in implementation:
  1083.  *
  1084.  *            Q3Shape_GetElement            =    Q3Set_Get
  1085.  *            Q3Shape_AddElement            =    Q3Set_Add
  1086.  *            Q3Shape_ContainsElement        =    Q3Set_Contains
  1087.  *            Q3Shape_GetNextElementType    =    Q3Set_GetNextElementType
  1088.  *            Q3Shape_EmptyElements        =    Q3Set_Empty
  1089.  *            Q3Shape_ClearElement        =    Q3Set_Clear
  1090.  *
  1091.  *    All of these calls accept a shape or a set as their first parameter.
  1092.  *
  1093.  *    The Q3Shape_GetSet and Q3ShapeSetSet calls are implemented via a new
  1094.  *    element type kQ3ElementTypeSet. See the note above about 
  1095.  *    kQ3ElementTypeSet;
  1096.  *
  1097.  *    It is important to note that the new Q3Shape_...Element... calls do not
  1098.  *    create a set on a shape and then add the element to it. This data is
  1099.  *    attached directly to the shape. Therefore, it is possible for an element
  1100.  *    to exist on a shape without a set existing on it as well. 
  1101.  *
  1102.  *    In your application, if you attach an element to a shape like this:
  1103.  *        (this isn't checking for errors for simplicity)
  1104.  *
  1105.  *        set = Q3Set_New();
  1106.  *        Q3Set_Add(set, gMyElemType, &data);
  1107.  *        Q3Shape_SetSet(shape, set);
  1108.  *
  1109.  *    You should retrieve it in the same manner:
  1110.  *
  1111.  *        Q3Shape_GetSet(shape, &set);
  1112.  *        if (Q3Set_Contains(set, gMyElemType) == kQ3True) {
  1113.  *            Q3Set_Get(set, gMyElemType, &data);
  1114.  *        }
  1115.  *
  1116.  *    Similarly, if you attach data to a shape with the new calls:
  1117.  *
  1118.  *        Q3Shape_AddElement(shape, gMyElemType, &data);
  1119.  *
  1120.  *    You should retrieve it in the same manner:
  1121.  *
  1122.  *        if (Q3Shape_ContainsElement(set, gMyElemType) == kQ3True) {
  1123.  *            Q3Shape_GetElement(set, gMyElemType, &data);
  1124.  *        }
  1125.  *
  1126.  *    This really becomes an issue when dealing with version 1.0 and version 1.1 
  1127.  *    metafiles.
  1128.  *
  1129.  *    When attempting to find a particular element on a shape, you should
  1130.  *    first check with Q3Shape_GetNextElementType or Q3Shape_GetElement, then,
  1131.  *    Q3Shape_GetSet(s, &set) (or Q3Shape_GetElement(s, kQ3ElementTypeSet, &set))
  1132.  *    and then Q3Shape_GetElement(set, ...).
  1133.  *
  1134.  *    In terms of implementation, Q3Shape_SetSet and Q3Shape_GetSet should only be
  1135.  *    used for sets of information that are shared among multiple shapes.
  1136.  *    
  1137.  *    Q3Shape_AddElement, Q3Shape_GetElement, etc. calls should only be used
  1138.  *    for elements that are unique for a particular shape.
  1139.  *    
  1140.  */
  1141. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3Shape_GetType(
  1142.     TQ3ShapeObject    shape);
  1143.  
  1144. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetSet(
  1145.     TQ3ShapeObject    shape,
  1146.     TQ3SetObject    *set);
  1147.  
  1148. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_SetSet(
  1149.     TQ3ShapeObject    shape,
  1150.     TQ3SetObject     set);
  1151.  
  1152. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_AddElement(
  1153.     TQ3ShapeObject    shape,
  1154.     TQ3ElementType    type,
  1155.     const void        *data);
  1156.  
  1157. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetElement(
  1158.     TQ3ShapeObject    shape,
  1159.     TQ3ElementType    type,
  1160.     void            *data);
  1161.     
  1162. QD3D_EXPORT TQ3Boolean QD3D_CALL Q3Shape_ContainsElement(
  1163.     TQ3ShapeObject    shape,
  1164.     TQ3ElementType    type);
  1165.  
  1166. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_GetNextElementType(
  1167.     TQ3ShapeObject    shape,
  1168.     TQ3ElementType    *type);
  1169.  
  1170. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_EmptyElements(
  1171.     TQ3ShapeObject    shape);
  1172.  
  1173. QD3D_EXPORT TQ3Status QD3D_CALL Q3Shape_ClearElement(
  1174.     TQ3ShapeObject    shape,
  1175.     TQ3ElementType    type);
  1176.  
  1177.  
  1178. /******************************************************************************
  1179.  **                                                                             **
  1180.  **                            Color Table Routines                             **
  1181.  **                                                                             **
  1182.  *****************************************************************************/
  1183.  
  1184.  
  1185. QD3D_EXPORT TQ3Status QD3D_CALL Q3Bitmap_Empty(
  1186.     TQ3Bitmap                    *bitmap);
  1187.  
  1188. QD3D_EXPORT unsigned long QD3D_CALL Q3Bitmap_GetImageSize(
  1189.     unsigned long                width,
  1190.     unsigned long                height);
  1191.  
  1192. #ifdef __cplusplus
  1193. }
  1194. #endif  /*  __cplusplus  */
  1195.  
  1196. #if defined(OS_MACINTOSH) && OS_MACINTOSH
  1197.  
  1198. #if defined(__xlc__) || defined(__XLC121__)
  1199.     #pragma options enum=reset
  1200.     #pragma options align=reset
  1201. #elif defined(__MWERKS__)
  1202.     #pragma enumsalwaysint reset
  1203.     #pragma options align=reset
  1204. #elif defined(__MRC__) || defined(__SC__)
  1205.     #if PRAGMA_ENUM_RESET_QD3D
  1206.         #pragma options(pack_enums)
  1207.         #undef PRAGMA_ENUM_RESET_QD3D
  1208.     #endif
  1209.     #pragma options align=reset
  1210. #endif
  1211.  
  1212. #endif  /* OS_MACINTOSH */
  1213.  
  1214. #endif /*  QD3D_h  */
  1215.  
  1216.